package quantum2.graph;

import quantum2.math.Complex;

public final class Matrix {

    private final Complex A;
    private final Complex B;
    private final Complex C;
    private final Complex K;

    final Complex K_FWD;
    final Complex K_AB;
    final Complex K_BA;

    public Matrix(Complex a, Complex b, Complex c, Complex k) {
        A = a;
        B = b;
        C = c;
        K = k;
        Complex d = K.sqr().mul(A.mul(C).sub(B.sqr()));
        Complex denom = Complex.number(-1).add(d).add(Complex.I.mul(K).mul(A.add(C)));
        Complex nom2 = Complex.number(2).mul(B).mul(Complex.I).mul(K);
        Complex nomAB = Complex.ONE.add(d).add(Complex.I.mul(K).mul(A.sub(C)));
        Complex nomBA = Complex.ONE.add(d).add(Complex.I.mul(K).mul(C.sub(A)));
        K_FWD = nom2.div(denom);
        K_AB = nomAB.div(denom);
        K_BA = nomBA.div(denom);
    }
}
